package com.xinxing.city.recovery.modules;

import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
import com.xinxing.city.recovery.APPRuntime;
import com.xinxing.city.recovery.Constant;
import com.xinxing.city.recovery.DeviceKernel;
import com.xinxing.city.recovery.interfaces.IDeviceKernel;
import com.xinxing.city.recovery.interfaces.IOrderManager;
import com.xinxing.city.recovery.interfaces.IRfidManager;
import com.xinxing.city.recovery.interfaces.ISerialSendReceiveData;
import com.xinxing.city.recovery.interfaces.ITtsService;
import com.xinxing.city.recovery.order.OrderManager;
import com.xinxing.city.recovery.rfid.RfidManager;
import com.xinxing.city.recovery.serialport.MockSerai;
import com.xinxing.city.recovery.serialport.SerialSendReceiveData;
import com.xinxing.city.recovery.tts.TtsService;

public class RecoveryModules extends AbstractModule {
    @Override
    protected void configure() {
        binder().bind(IDeviceKernel.class).to(DeviceKernel.class).in(Scopes.SINGLETON);
        binder().bind(IOrderManager.class).to(OrderManager.class).in(Scopes.SINGLETON);
        if(!Constant.MOCK) {
            binder().bind(ISerialSendReceiveData.class).to(SerialSendReceiveData.class).in(Scopes.SINGLETON);
        }else{
            binder().bind(ISerialSendReceiveData.class).to(MockSerai.class).in(Scopes.SINGLETON);
        }
        binder().bind(IRfidManager.class).to(RfidManager.class).in(Scopes.SINGLETON);
        binder().bind(ITtsService.class).to(TtsService.class).in(Scopes.SINGLETON);
        binder().bind(APPRuntime.class).in(Scopes.SINGLETON);
    }
}
